var http = require('http')

http.createServer((req, res) => {
    // cors跨域
    res.setHeader('Access-Control-Allow-Origin', '*')
    res.setHeader('Access-Control-Allow-Methods', '*')
    if(req.url === '/') {
        // getData('hello world')

        var data = {
            name: '张三',
            age: 20,
            id: 121892012,
            accound: 'zhangsan',
            psw: 123456
        }

        data = JSON.stringify(data)
        res.end(data)
    }
}).listen('3000', () => {
    console.log('server is running')
})